const path = require("path")
const htmlWebpackPlugin = require("html-webpack-plugin")
const miniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
    mode: 'development',
    devtool: 'inline-source-map',
    //devServer服务启动目录
    devServer: {
        static: './dist'
    },
    // optimization: {
    //     splitChunks: {
    //         chunks: 'all',
    //     }
    // },
    entry: {
        main: './main.js',
        // print: './src/print.js',
    },//入口
    output: {
        filename: "[name].bundle.js", //打包后的文件名称 [name] 默认是main.js
        path: path.resolve(__dirname, "dist"), //打包后的文件路径
        clean: true,
        // publicPath: "/",  启用node 服务器的时候才需要
    },
    plugins: [
        //如果要修改标题，index.html 中需要读取这个title <%= htmlWebpackPlugin.options.title %>
        new htmlWebpackPlugin({
            template: "./index.html",
            title: 'Development',
        }),
        new miniCssExtractPlugin(),
    ],
    module: {
        rules: []
    }
}



